package com.kashow.bean.teacher.teachercircle;

import android.text.TextUtils;

import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.kashow.bean.BaseBean;
import com.kashow.bean.circle.AudioBean;
import com.kashow.bean.circle.CircleItemBean;

import java.util.List;

/**
 * Created by cg on 17/1/6.
 */

public class TeacherCircleBean extends BaseBean implements MultiItemEntity {
    private static final String TYPE_VIDEO = "video";
    private static final String TYPE_IMAGE = "image";


    /**
     * _id : 1
     * title : 测试
     * type : 1
     * audio : 1
     * cover : http://oh2ucnq1s.bkt.clouddn.com/88283fb87a724c56114265d1abe3a46f
     * user : {"_id":5,"unionid":"ojmTMwFUyD5xpIMUgJE9ZyXRIr8A","appopenid":"o2BvkvosUtI04uO5xz6E-YZu2hfc","phone":"15822774691","wxUserInfo":{"openid":"o2BvkvosUtI04uO5xz6E-YZu2hfc","nickname":"李文跃","sex":1,"language":"zh_CN","city":"Hangzhou","province":"Zhejiang","country":"CN","headimgurl":"http://wx.qlogo.cn/mmopen/ajNVdqHZLLAwcXiah3aSicgoqzbA4hn2Cy2rBnWZOlIvDdWujj5kNg5dtcP6SMWaqcicJ42IFwfkhhHhGicWVwpcvQ/0","unionid":"ojmTMwFUyD5xpIMUgJE9ZyXRIr8A","tagid_list":[]},"authInfo":{"intro":"暂无","realName":"李文跃","cardNumber":"360731199909010234","cardPic1":"http://oss.kashowvr.com/wx/upload/media/z5Q5ZCR_xGpIedrR6DFrOLsN7AMcYOfVxh78oEdTWaPeG7SHbfHhxBv3fwFnXV60.","cardPic2":"http://oss.kashowvr.com/wx/upload/media/YgVR0DmsSD903YNpW1MUebf4XlYVu6Qoi6ojyb2GRziOLCKY355E9HDRQ9WBV0YN.","status":1,"updatedAt":"2017-01-04T09:41:46.022Z","createdAt":"2017-01-03T07:29:49.255Z"},"nickname":"李文跃","headimgurl":"http://wx.qlogo.cn/mmopen/ajNVdqHZLLAicTZdlCFABRZgdY1MKMfzbGibiceNk7ibibUibJ3xGdUUqGT6JLDD1DBrU5ia5uhjBWKHwSULfpL6IUB7w/0","createdAt":"2017-01-03T06:10:00.874Z","isSub":false,"sex":0,"balance":0,"score":0,"level":1,"isTeacher":true,"__v":0}
     * deleted : 0
     * watch : 66
     * updatedAt : 2017-01-03T06:10:45.972Z
     * content : {"type":"image","item":[{"imageUrl":"http://oh2ucnq1s.bkt.clouddn.com/88283fb87a724c56114265d1abe3a46f"},{"imageUrl":"http://oh2ucnq1s.bkt.clouddn.com/548044540c50cdfeb86d80a322d66ef8"},{"imageUrl":"http://oh2ucnq1s.bkt.clouddn.com/e4bd557e99f16d9e2a4863a9470b58bc"}]}
     * createdAt : 2017-01-03 14:10:45
     * __v : 0
     * id : 1
     */

    private int _id;
    private String title;
    private int type;
    private AudioBean audio;
    private String cover;
    private UserBean user;
    private int deleted;
    private int watch;
    private String updatedAt;
    private ContentBean content;
    private String createdAt;
    private String id;

    public int get_id() {
        return _id;
    }

    public void set_id(int _id) {
        this._id = _id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public AudioBean getAudio() {
        return audio;
    }

    public void setAudio(AudioBean audio) {
        this.audio = audio;
    }

    public String getCover() {
        return cover;
    }

    public void setCover(String cover) {
        this.cover = cover;
    }

    public UserBean getUser() {
        return user;
    }

    public void setUser(UserBean user) {
        this.user = user;
    }

    public int getDeleted() {
        return deleted;
    }

    public void setDeleted(int deleted) {
        this.deleted = deleted;
    }

    public int getWatch() {
        return watch;
    }

    public void setWatch(int watch) {
        this.watch = watch;
    }

    public String getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(String updatedAt) {
        this.updatedAt = updatedAt;
    }

    public ContentBean getContent() {
        return content;
    }

    public void setContent(ContentBean content) {
        this.content = content;
    }

    public String getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(String createdAt) {
        this.createdAt = createdAt;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public static class UserBean {
        /**
         * _id : 5
         * unionid : ojmTMwFUyD5xpIMUgJE9ZyXRIr8A
         * appopenid : o2BvkvosUtI04uO5xz6E-YZu2hfc
         * phone : 15822774691
         * wxUserInfo : {"openid":"o2BvkvosUtI04uO5xz6E-YZu2hfc","nickname":"李文跃","sex":1,"language":"zh_CN","city":"Hangzhou","province":"Zhejiang","country":"CN","headimgurl":"http://wx.qlogo.cn/mmopen/ajNVdqHZLLAwcXiah3aSicgoqzbA4hn2Cy2rBnWZOlIvDdWujj5kNg5dtcP6SMWaqcicJ42IFwfkhhHhGicWVwpcvQ/0","unionid":"ojmTMwFUyD5xpIMUgJE9ZyXRIr8A","tagid_list":[]}
         * authInfo : {"intro":"暂无","realName":"李文跃","cardNumber":"360731199909010234","cardPic1":"http://oss.kashowvr.com/wx/upload/media/z5Q5ZCR_xGpIedrR6DFrOLsN7AMcYOfVxh78oEdTWaPeG7SHbfHhxBv3fwFnXV60.","cardPic2":"http://oss.kashowvr.com/wx/upload/media/YgVR0DmsSD903YNpW1MUebf4XlYVu6Qoi6ojyb2GRziOLCKY355E9HDRQ9WBV0YN.","status":1,"updatedAt":"2017-01-04T09:41:46.022Z","createdAt":"2017-01-03T07:29:49.255Z"}
         * nickname : 李文跃
         * headimgurl : http://wx.qlogo.cn/mmopen/ajNVdqHZLLAicTZdlCFABRZgdY1MKMfzbGibiceNk7ibibUibJ3xGdUUqGT6JLDD1DBrU5ia5uhjBWKHwSULfpL6IUB7w/0
         * createdAt : 2017-01-03T06:10:00.874Z
         * isSub : false
         * sex : 0
         * balance : 0
         * score : 0
         * level : 1
         * isTeacher : true
         * __v : 0
         */

        private int _id;
        private String unionid;
        private String appopenid;
        private String phone;
        private WxUserInfoBean wxUserInfo;
        private AuthInfoBean authInfo;
        private String nickname;
        private String headimgurl;
        private String createdAt;
        private boolean isSub;
        private int sex;
        private int balance;
        private float score;
        private int level;
        private boolean isTeacher;

        public int get_id() {
            return _id;
        }

        public void set_id(int _id) {
            this._id = _id;
        }

        public String getUnionid() {
            return unionid;
        }

        public void setUnionid(String unionid) {
            this.unionid = unionid;
        }

        public String getAppopenid() {
            return appopenid;
        }

        public void setAppopenid(String appopenid) {
            this.appopenid = appopenid;
        }

        public String getPhone() {
            return phone;
        }

        public void setPhone(String phone) {
            this.phone = phone;
        }

        public WxUserInfoBean getWxUserInfo() {
            return wxUserInfo;
        }

        public void setWxUserInfo(WxUserInfoBean wxUserInfo) {
            this.wxUserInfo = wxUserInfo;
        }

        public AuthInfoBean getAuthInfo() {
            return authInfo;
        }

        public void setAuthInfo(AuthInfoBean authInfo) {
            this.authInfo = authInfo;
        }

        public String getNickname() {
            if (TextUtils.isEmpty(nickname) && wxUserInfo != null) {
                nickname = wxUserInfo.getNickname();
            }
            return nickname;
        }

        public void setNickname(String nickname) {
            this.nickname = nickname;
        }

        public String getHeadimgurl() {
            if (TextUtils.isEmpty(headimgurl) && wxUserInfo != null) {
                headimgurl = wxUserInfo.getHeadimgurl();
            }
            return headimgurl;
        }

        public void setHeadimgurl(String headimgurl) {
            this.headimgurl = headimgurl;
        }

        public String getCreatedAt() {
            return createdAt;
        }

        public void setCreatedAt(String createdAt) {
            this.createdAt = createdAt;
        }

        public boolean isIsSub() {
            return isSub;
        }

        public void setIsSub(boolean isSub) {
            this.isSub = isSub;
        }

        public int getSex() {
            return sex;
        }

        public void setSex(int sex) {
            this.sex = sex;
        }

        public int getBalance() {
            return balance;
        }

        public void setBalance(int balance) {
            this.balance = balance;
        }

        public float getScore() {
            return score;
        }

        public void setScore(float score) {
            this.score = score;
        }

        public int getLevel() {
            return level;
        }

        public void setLevel(int level) {
            this.level = level;
        }

        public boolean isIsTeacher() {
            return isTeacher;
        }

        public void setIsTeacher(boolean isTeacher) {
            this.isTeacher = isTeacher;
        }

        public static class WxUserInfoBean {
            /**
             * openid : o2BvkvosUtI04uO5xz6E-YZu2hfc
             * nickname : 李文跃
             * sex : 1
             * language : zh_CN
             * city : Hangzhou
             * province : Zhejiang
             * country : CN
             * headimgurl : http://wx.qlogo.cn/mmopen/ajNVdqHZLLAwcXiah3aSicgoqzbA4hn2Cy2rBnWZOlIvDdWujj5kNg5dtcP6SMWaqcicJ42IFwfkhhHhGicWVwpcvQ/0
             * unionid : ojmTMwFUyD5xpIMUgJE9ZyXRIr8A
             * tagid_list : []
             */

            private String openid;
            private String nickname;
            private int sex;
            private String language;
            private String city;
            private String province;
            private String country;
            private String headimgurl;
            private String unionid;
            private List<?> tagid_list;

            public String getOpenid() {
                return openid;
            }

            public void setOpenid(String openid) {
                this.openid = openid;
            }

            public String getNickname() {
                return nickname;
            }

            public void setNickname(String nickname) {
                this.nickname = nickname;
            }

            public int getSex() {
                return sex;
            }

            public void setSex(int sex) {
                this.sex = sex;
            }

            public String getLanguage() {
                return language;
            }

            public void setLanguage(String language) {
                this.language = language;
            }

            public String getCity() {
                return city;
            }

            public void setCity(String city) {
                this.city = city;
            }

            public String getProvince() {
                return province;
            }

            public void setProvince(String province) {
                this.province = province;
            }

            public String getCountry() {
                return country;
            }

            public void setCountry(String country) {
                this.country = country;
            }

            public String getHeadimgurl() {
                return headimgurl;
            }

            public void setHeadimgurl(String headimgurl) {
                this.headimgurl = headimgurl;
            }

            public String getUnionid() {
                return unionid;
            }

            public void setUnionid(String unionid) {
                this.unionid = unionid;
            }

            public List<?> getTagid_list() {
                return tagid_list;
            }

            public void setTagid_list(List<?> tagid_list) {
                this.tagid_list = tagid_list;
            }
        }

        public static class AuthInfoBean {
            /**
             * intro : 暂无
             * realName : 李文跃
             * cardNumber : 360731199909010234
             * cardPic1 : http://oss.kashowvr.com/wx/upload/media/z5Q5ZCR_xGpIedrR6DFrOLsN7AMcYOfVxh78oEdTWaPeG7SHbfHhxBv3fwFnXV60.
             * cardPic2 : http://oss.kashowvr.com/wx/upload/media/YgVR0DmsSD903YNpW1MUebf4XlYVu6Qoi6ojyb2GRziOLCKY355E9HDRQ9WBV0YN.
             * status : 1
             * updatedAt : 2017-01-04T09:41:46.022Z
             * createdAt : 2017-01-03T07:29:49.255Z
             */

            private String intro;
            private String realName;
            private String cardNumber;
            private String cardPic1;
            private String cardPic2;
            private int status;
            private String updatedAt;
            private String createdAt;

            public String getIntro() {
                return intro;
            }

            public void setIntro(String intro) {
                this.intro = intro;
            }

            public String getRealName() {
                return realName;
            }

            public void setRealName(String realName) {
                this.realName = realName;
            }

            public String getCardNumber() {
                return cardNumber;
            }

            public void setCardNumber(String cardNumber) {
                this.cardNumber = cardNumber;
            }

            public String getCardPic1() {
                return cardPic1;
            }

            public void setCardPic1(String cardPic1) {
                this.cardPic1 = cardPic1;
            }

            public String getCardPic2() {
                return cardPic2;
            }

            public void setCardPic2(String cardPic2) {
                this.cardPic2 = cardPic2;
            }

            public int getStatus() {
                return status;
            }

            public void setStatus(int status) {
                this.status = status;
            }

            public String getUpdatedAt() {
                return updatedAt;
            }

            public void setUpdatedAt(String updatedAt) {
                this.updatedAt = updatedAt;
            }

            public String getCreatedAt() {
                return createdAt;
            }

            public void setCreatedAt(String createdAt) {
                this.createdAt = createdAt;
            }
        }
    }

    public static class ContentBean {
        /**
         * type : image
         * item : [{"imageUrl":"http://oh2ucnq1s.bkt.clouddn.com/88283fb87a724c56114265d1abe3a46f"},{"imageUrl":"http://oh2ucnq1s.bkt.clouddn.com/548044540c50cdfeb86d80a322d66ef8"},{"imageUrl":"http://oh2ucnq1s.bkt.clouddn.com/e4bd557e99f16d9e2a4863a9470b58bc"}]
         */

        private String type;
        private List<CircleItemBean> item;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public List<CircleItemBean> getItem() {
            return item;
        }

        public void setItem(List<CircleItemBean> item) {
            this.item = item;
        }
    }

    @Override
    public int getItemType() {
        if (TYPE_VIDEO.equals(content.getType())){
            return 3;
        } else {
            if (content != null && content.getItem() != null && content.getItem().size() >=3) {
                return 2;
            }
        }
        return 1;
    }

}
